﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using SystemAnalizer.Utils;
using SystemAnalizer.Common;
using SystemAnalizer.Models;

namespace SystemAnalizer
{
    /// <summary>
    /// Interaction logic for CreateSystem.xaml
    /// </summary>
    public partial class CreateSystem : Window
    {
        private ProgramSettings prog_settings;
        private int systemsize;
        public CreateSystem(ProgramSettings progset)
        {
            InitializeComponent();
            LoadSettings(progset);
        }

        private void LoadSettings(ProgramSettings progset)
        {
            this.prog_settings = progset;
            ProgramSettings.ResourceActivator(this.prog_settings.GetSettingStruct.culture, this.Resources);
        }

        private void SystemSizetxb_TextChanged(object sender, TextChangedEventArgs e)
        {
            
            try
            {
                this.systemsize = Convert.ToInt32(this.SystemSizetxb.Text);
            }
            catch
            {
                ErrorDialogs.PrintErrorDialog(CommonString.Insert_Valid_integer);
                return;
            }
            if (this.systemsize < 0)
            {
                ErrorDialogs.PrintErrorDialog("Insert valid integer");
                return;
            }

            MatrixModels.VisualMatrixMaker(this.systemsize, SystemValuesgrd);
        }
    }
}
